package com.nl.controller.xuyi.controller;


import com.github.pagehelper.PageInfo;
import com.nl.controller.common.model.Response;
import com.nl.controller.common.util.ResponseUtil;
import com.nl.controller.web.bean.SmsUsers;
import com.nl.controller.xuyi.bean.XuYiBlackUserInfo;
import com.nl.controller.xuyi.bean.XuYiOperatorInfo;
import com.nl.controller.web.global.GlobalConst;
import com.nl.controller.xuyi.service.XuYiBlackUserService;
import com.nl.controller.xuyi.service.XuYiOperatorService;
import com.nl.controller.web.util.FileUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;

@RestController
@RequestMapping("xuYiBlackUser")
@Slf4j
public class XuYiBlackUserController {

    @Autowired
    private XuYiBlackUserService xuYiBlackUserService;

    @PostMapping("find")
    public Response findBlackUser(
            @RequestParam(value = "page", required = true) int page,
            @RequestParam(value = "limit", required = true) int limit,
            @RequestParam(value = "phoneNumber", required = false) String phoneNumber,
            @RequestParam Map<String, Object> paramMap
    ) {
        PageInfo<XuYiBlackUserInfo> pageInfo = xuYiBlackUserService.findBlackUserByTel(page, limit, phoneNumber);
        log.info("黑名单人员查询：{}", paramMap.toString());
        log.debug("黑名单人员查询返回数据：{}", pageInfo.getList().toString());
        return ResponseUtil.sucess(pageInfo.getList(), pageInfo.getTotal());
    }

    @PostMapping("delete")
    @ApiImplicitParam(name = "phoneNumber", value = "手机号码", required = true, dataType = "String")
    public int deleteOperator(@RequestParam(value = "phoneNumber") String phoneNumber) {
        int result= xuYiBlackUserService.deleteBlackUser(phoneNumber);
        log.info("黑名单删除参数：{}", phoneNumber);
        log.debug("黑名单删除返回数据：{}", result);
        return result;
    }

   
}
